<template>
  <div class="banner-container">
    <transition-group name="banner-slide">
      <div 
        v-for="banner in desktopStore.notificationBanners" 
        :key="banner.id" 
        class="banner"
        @mouseenter="pause(banner.id)"
        @mouseleave="resume(banner.id)"
      >
        <div class="banner-icon" v-if="banner.icon">{{ banner.icon }}</div>
        <div class="banner-content">
          <div class="banner-title">{{ banner.title }}</div>
          <div class="banner-body" v-if="banner.body">{{ banner.body }}</div>
        </div>
        <button class="banner-close" @click="desktopStore.removeNotification(banner.id)">×</button>
      </div>
    </transition-group>
  </div>
</template>

<script setup lang="ts">
import { useDesktopStore } from '../../stores/desktop'

const desktopStore = useDesktopStore()

function pause(id: number) {
  // 未来可扩展：悬停暂停自动关闭
}
function resume(id: number) {
  // 未来可扩展：恢复计时器
}
</script>

<style scoped>
.banner-container {
  position: fixed;
  top: 40px;
  right: 8px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10002;
  pointer-events: none;
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(245, 245, 247, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  pointer-events: all;
}

.banner-icon {
  font-size: 20px;
  line-height: 1;
}

.banner-title {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
}

.banner-body {
  font-size: 12px;
  color: #666;
}

.banner-close {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #999;
}

.banner-close:hover {
  color: #666;
}

.banner-slide-enter-active,
.banner-slide-leave-active {
  transition: all 0.25s var(--ease-default, cubic-bezier(0.4, 0, 0.2, 1));
}
.banner-slide-enter-from { opacity: 0; transform: translateX(30px); }
.banner-slide-leave-to { opacity: 0; transform: translateX(30px); }
</style>


